package com.skylin.mysell.converter;

import com.skylin.mysell.dto.OrderDTO;
import com.skylin.mysell.entities.OrderMaster;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author quanlinlin on 2018/12/25 23:07.
 * @version 1.0
 */
public class OrderMaster2OrderDto {

    public static OrderDTO convert(OrderMaster orderMaster) {
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster, orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> convert(List<OrderMaster> orderMasterList) {
        return orderMasterList.stream().map(orderMaster -> convert(orderMaster)).collect(Collectors.toList());
    }
}
